﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Input;
using Unity;
using WpfTestDemo.Bll;
using WpfTestDemo.Core;
using WpfTestDemo.Model;

namespace WpfTestDemo.ViewModel
{
    /// <summary>
    /// 主窗体ViewModel类
    /// </summary>
    public class MainControlViewModel
    {

        private MainControlModel _TestDemoModel = new MainControlModel();

        TestInfoBll testInfoBll = new TestInfoBll();

        public MainControlModel TestDemoModel
        {
            get { return _TestDemoModel; }
            set { _TestDemoModel = value; }
        }

        public ICommand AddCommand
        {
            get
            {
                return new RelayCommand(() =>
                {
                    if (!string.IsNullOrEmpty(TestDemoModel.TestContent))
                        testInfoBll.Add(new TestInfoCore() { TestContent = TestDemoModel.TestContent });
                });
            }
        }
    }
}
